<?php

class downloadsModel extends Model{
	
	public $_tabela = "tbldownloads";

	public function lista( $quant = null ){
		return $this->read(null, $quant, null, " id DESC");
	}
			
	public function Destaque( $where = null, $limit = null, $orderby = null  ){
		return $this->read( $where , $limit , null , $orderby );
	}

	public function Id( $where ){
		return $this->read( " id = " . $where );
	}
	
	public function salvar( $array = array() ,  $id = null ){
		if( empty( $id ) ){
			return $this->insert( $array );
		}else{
			return $this->update( $array , " id = ".$id );
		}
	}
	
	public function excluir( $id = null ){
		if( !empty( $id ) ){
			return $this->delete( " id = " .$id );
		}
	}
	
	public function setStatus( $id ){
		return $this->updateCheck( array ( "status" => "!status"  ) , " id = ".$id );
	}


}
	